<script>
import { getUserList } from '../../api/user';
export default {
  name: 'UserList',
  data () {
    return {
      userList: [],
      currentPage: 1
    }
  },
  computed: {
    computedTableData () {
      return this.userList.slice((this.currentPage - 1) * 13, (this.currentPage - 1) * 13 + 13)
    }
  },
  mounted () {
    getUserList().then(res => {
      console.log(res);
      this.userList = res.data
    })
  }
}
</script>
<template>
  <div>
    <p>用户列表</p>

    <el-table :data="computedTableData">
      <el-table-column type="index" label="序号" width="80" />
      <el-table-column prop="telcode" label="用户名" />
      <el-table-column prop="tel" label="手机号" />
      <el-table-column prop="email" label="邮箱" />

    </el-table>
    <el-pagination background layout="prev, pager, next" :page-size="13" :total="userList.length"
      v-model:current-page="currentPage" />
  </div>
</template>
